Skip to content

Handle comments before rule colons - #786

Merged
ydah merged 1 commit into
ruby:masterfrom
ydah:fix/rule-lhs-comment-lookahead
Sep 4, 2026
Merged

Handle comments before rule colons#786
ydah merged 1 commit into
ruby:masterfrom
ydah:fix/rule-lhs-comment-lookahead

Conversation

@ydah

@ydah ydah commented Mar 28, 2026

Copy link
Copy Markdown
Member

Fix a lexer edge case where a rule name followed by a block comment before : is tokenized incorrectly.

Previously, the lexer only looked through whitespace when deciding whether an identifier should be emitted as IDENT_COLON. As a result,
inputs like the following were parsed incorrectly:

stmt
  /* some block comment */
  :

This caused rule headers to be tokenized as IDENTIFIER instead of IDENT_COLON, which then led to parse errors on grammars.

@ydah
ydah force-pushed the fix/rule-lhs-comment-lookahead branch from 98f82d8 to fa4f478 Compare April 28, 2026 08:12
@ydah
ydah merged commit 3c6bd12 into ruby:master Sep 4, 2026
23 checks passed
@ydah
ydah deleted the fix/rule-lhs-comment-lookahead branch September 4, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant